<template>
  <view class="form-main">
    密码：<input type="text" :password="isShowPwd" placeholder="请输入密码" />
    <switch type="switch" @change="showPwd" color="#FF0000" style="transform: scale(0.7);"></switch>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        isShowPwd: false
      };
    },
    methods: {
      showPwd: function(e) {
        console.log(!e.target.value);
        this.isShowPwd = !e.target.value;
      }
    }
  }
</script>

<style lang="scss">
  .form-main {
    display: flex;
  }
</style>